package com.nms.service.impl;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import org.springframework.transaction.annotation.Transactional;

import com.nms.dao.NewsDao;
import com.nms.model.News;
import com.nms.model.pojo.PageParam;
import com.nms.service.NewsService;

public class NewsServiceImpl implements NewsService {

	private NewsDao newsDao;
	
	public NewsDao getNewsDao() {
		return newsDao;
	}

	public void setNewsDao(NewsDao newsDao) {
		this.newsDao = newsDao;
	}

	//////////////////////////////////////////////
	@Transactional
	@Override
	public List<News> findAll() {
		return newsDao.findAll();
	}

	@Transactional
	@Override
	public List<News> findByPage(PageParam pageParam) {
		return newsDao.findByPage(pageParam);
	}

	@Transactional
	@Override
	public List<News> findByKeyword(String keyword,PageParam pageParam) {
		return newsDao.findByKeyword(keyword,pageParam);
	}

	@Transactional
	@Override
	public List<News> findByDate(Date date,PageParam pageParam) {
		return newsDao.findByDate(date,pageParam);
	}

	@Transactional
	@Override
	public List<News> findByType(Integer type,PageParam pageParam) {
		return newsDao.findByType(type,pageParam);
	}

	@Transactional
	@Override
	public News findById(String id) {
		return newsDao.findById(id);
	}

	@Transactional
	@Override
	public boolean deleteById(String id) {
		return newsDao.deleteById(id);
	}

	@Transactional
	@Override
	public boolean update(News news) {
		return newsDao.update(news);
	}

	@Transactional
	@Override
	public Serializable add(News news) {
		return newsDao.add(news);
	}

	@Transactional
	@Override
	public List<News> findHomepageNews() {
		return newsDao.findHomepageNews();
	}

}
